/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extras;

import estruturas.IdString;
import java.util.LinkedList;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

/**
 *
 * @author Diego
 */
public class jcomboboxmodel extends AbstractListModel implements ComboBoxModel
{

    private LinkedList<IdString> palavra = new LinkedList<>();
    private IdString selecionado;

    @Override
    public int getSize()
    {
        return palavra.size();
    }

    @Override
    public Object getElementAt(int index)
    {
        return palavra.get(index);
    }

    public void addElement(IdString a)
    {
        palavra.add(a);
    }

    @Override
    public void setSelectedItem(Object anItem)
    {
        selecionado = (IdString) anItem;
    }

    @Override
    public Object getSelectedItem()
    {
        return selecionado;
    }

    public void clear()
    {
        palavra.clear();
    }

}
